<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="<? echo $this->settings->charset; ?>" />
	<title><?echo $this->settings->sitetitle; ?></title> 
		<link href="<?echo $this->settings->siteurl;?>themes/<?php echo $this->settings->theme; ?>/css/style.css.php" rel="stylesheet" type="text/css" />
		<link href="<?echo $this->settings->siteurl;?>themes/<?php echo $this->settings->theme; ?>/css/layout.css.php" rel="stylesheet" type="text/css" /> 		
		<!--[if IE]>
			<script src="<?php echo $this->settings->siteurl; ?>library/javascripts/html5.js"></script><![endif]-->
		<!--[if lt IE 7]>
			<script src="<?php echo $this->settings->siteurl; ?>library/javascripts/IE7.js"></script>
		<!--[if lt IE 8]>
			<script src="<?php echo $this->settings->siteurl; ?>library/javascripts/IE8.js"></script>
		<!--[if lt IE 9]>
			<script src="<?php echo $this->settings->siteurl; ?>library/javascripts/IE9.js"></script>
		<![endif]-->
		<script type="text/javascript" src="<?php echo $this->settings->siteurl; ?>library/javascripts/jquery.js"></script>
		<script type="text/javascript" src="<?php echo $this->settings->siteurl; ?>library/javascripts/jquery-ui.js"></script>
		<script type="text/javascript" src="<?php echo $this->settings->siteurl; ?>library/javascripts/tiny_mce/jquery.tinymce.js"></script>
		<script type="text/javascript" src="<?php echo $this->settings->siteurl; ?>library/javascripts/custom.js"></script>
		<script tyoe="text/javascript">
				$().ready(function() {
					$('textarea.tinymce').tinymce({
						script_url : '<?php echo $this->settings->siteurl; ?>library/javascripts/tiny_mce/tiny_mce.js',
						theme : "advanced",
						plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
						theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
						theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
						theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
						theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
						theme_advanced_toolbar_location : "top",
						theme_advanced_toolbar_align : "left",
						theme_advanced_statusbar_location : "bottom",
						theme_advanced_resizing : true,
					});
				})
		</script>
		<?php
		if(iADMIN){
			

			
			$cache = new DB("admin_cache");
			$cache->setColPrefix("admin_");
			$cache->select("admin_user='".USER_ID."'");
						
			while($cache->nextRecord()){
				echo "<script>
				
				$(document).ready(function() {
					$('#".$cache->window."').show();			
				});
				</script>";
			}
		}
		
		?>
		
</head>
<body>
	
	<?php
		if(iADMIN){
	?>
		<link href="<?echo $this->settings->siteurl;?>images/colorpicker.css" rel="stylesheet" type="text/css" />
		<link href="<?echo $this->settings->siteurl;?>themes/<?php echo $this->settings->theme; ?>/css/admin-toolbar.css" rel="stylesheet" type="text/css" /> 
		<script type="text/javascript" src="<?php echo $this->settings->siteurl; ?>library/javascripts/admin.js"></script>
	
	<?php
	
				$settings = new DB("settings");
				$settings->select();
				$settings->nextRecord();
	
				$tpl = new Template;
				$tpl->settings = $settings;
				$tpl->Build("admin_tpl");
				
			}
	?>
	
	<section id="layout"> 
		<header id="header"> 
		  <h1><a href='<?php echo $this->settings->siteurl; ?>'><?php echo $this->settings->sitename; ?></a></h1> 
		</header>

		<nav id="topnav"> 
			<ul> 
				<?php echo $this->navigation; ?>
			</ul> 
		</nav>
			<section id="container">
				<aside id="sidebar-left">  